<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:1px;">
  <t:datagrid name="hacodeList" title="自动发号" actionUrl="hacodeController.do?datagrid" idField="id" fit="true">
   <t:dgCol title="编号" field="id" hidden="false"></t:dgCol>
   <t:dgCol title="关键词" field="gamename" width="60"></t:dgCol>
   <t:dgCol title="总号数量" field="total" width="60"></t:dgCol>
   <t:dgCol title="剩余数量" field="surplus" width="50"></t:dgCol>
   <t:dgCol title="操作" field="opt" width="120"></t:dgCol>
   <t:dgFunOpt funname="showHcode(id)" title="已发号码"></t:dgFunOpt>
   <t:dgDelOpt title="删除" url="hacodeController.do?del&id={id}" />
   <t:dgToolBar title="添加" icon="icon-add" url="hacodeController.do?addOrUpdate" funname="myadd"  height="500"></t:dgToolBar>
   <t:dgToolBar title="编辑" icon="icon-edit" url="hacodeController.do?addOrUpdate" funname="hupdate" height="500"></t:dgToolBar>
  </t:datagrid>
  <script type="text/javascript">
  	function showHcode(id){
  		var url = "hacodeController.do?goHacodeRecord&haid="+id;
  		createdetailwindow("已发号码", url, 650, 450);
  	}
  	function myadd(title,addurl,gname,width,height) {
 		createwindow("添加自动发号", addurl, 594, 338);
 	}
  	function hupdate(title,url,gname,width,height) {
		var rowsData = $('#'+gname).datagrid('getSelections');
		if (!rowsData || rowsData.length==0) {
			tip("请选择编辑项目");
			return;
		}
		if (rowsData.length>1) {
			tip("请选择一条记录再编辑");
			return;
		}
		url += '&id='+rowsData[0].id;
 		createwindow("编辑自动发号", url, 594, 338);
 	}
  </script>
  </div>
 </div>